﻿0 rem --- Tron for the Atari VCS, Initialization section:
1 if g<>0 then goto 20
2 for x=18 to 239
3 virtualworld(x)=0
4 next x
5 for x=0 to 9
6 g=g+10
7 rowcolors(x)=g
8 next x
9 x=10
10 y=5
11 h=1: rem initial dir right
12 rem --- End Initialization section, g is no longer 0 so line 1 will always skip init
19 rem ---- game start
20 f=f+1: rem f is a delay variable, game logic runs every 4 frames:
21 if f>3 then goto 24:rem used a goto to allow vertical structure:
22 scrollvirtualworldtoggle=0
23 return
24 scrollvirtualworldtoggle=1
30 if joy0left<>1 then goto 40: rem used a goto to allow vertical structure:
31 e=1: rem e,h,i,j are direction variables (light cycle is always moving)
32 h=0:rem if one is set, the other three are turned off (one direction at a time)
33 i=0
34 j=0
35 AUDC0=8
36 AUDF0=BITIndex
37 SUSTAINFORFRAMES=15
40 if joy0right<> 1 then goto 50: rem used a goto to allow vertical structure:
41 h=1
42 e=0
43 i=0
44 j=0
45 AUDC0=6
46 AUDF0=BITIndex
47 SUSTAINFORFRAMES=15
50 if joy0down<>1 then goto 60: rem used a goto to allow vertical structure:
51 i=12
52 e=0
53 h=0
54 j=0
55 AUDF0=y*3
56 AUDC0=15
57 SUSTAINFORFRAMES=15
60 if joy0up<>1 then goto 70: rem used a goto to allow vertical structure:
61 j=12
62 i=0
63 e=0
64 h=0
65 AUDC0=3
66 AUDF0=y*2
67 SUSTAINFORFRAMES=15
70 x=x-e
71 x=x+h
72 l=i/12
73 y=y+l
74 l=j/12
75 y=y-l
76 BYTErowoffset=BYTErowoffset+i
77 rem TRON!!
80 BITIndex=BITIndex-e
81 BITIndex=BITIndex+h
82 BYTErowoffset=BYTErowoffset-j
83 f=0
88 rem set pixel on virtualworld bitmap, and poll prior state for collision:
90 if vwpixel(x,y,on)=0 then return
91 COLUBK=100
92 SUSTAINFORFRAMES=100
93 goto 60
100 rem Atari VCS